"""辅助函数
printer: 打印函数的返回值
"""
from pathlib import Path
from typing import Union


def printer(func):
    """打印函数的返回值
    """
    def inner(*args, **kwargs):
        print(func(*args, **kwargs))
        return func(*args, **kwargs)
    return inner


def read_file(path_str: Union[str, Path], mode="rb") -> Union[bytes, str]:
    """
    Read the file at the given path.
    """
    with open(path_str, mode=mode) as f:  # pylint: disable=invalid-name,unspecified-encoding
        return f.read()
